import type { PageParams, PageResult } from '@/types/global';
import type {
  BannerItem,
  GuessItem,
  categoryItem,
  hotItem,
} from '@/types/home';
import { http } from '@/utils/https';

/**
 * 首页-广告区域
 * @param distributionSite 广告区域展示位置1 为首页（默认值）2 为商品分类页
 */
export const getHomeBannerAPI = (distributionSite = 1) => {
  return http<BannerItem[]>({
    method: 'GET',
    url: '/home/banner',
    data: {
      distributionSite,
    },
  });
};

/**
 * 首页分类
 */
export const getHomeCategoryAPI = () => {
  return http<categoryItem[]>({
    method: 'GET',
    url: '/home/category/mutli',
  });
};

/**
 * 首页-热门推荐
 */
export const getHomeHotAPI = () => {
  return http<hotItem[]>({
    method: 'GET',
    url: '/home/hot/mutli',
  });
};
/**
 * 首页-猜你喜欢
 */
export const getHomeGoodGuessLikeAPI = (data?: PageParams) => {
  return http<PageResult<GuessItem>>({
    method: 'GET',
    url: '/home/goods/guessLike',
    data,
  });
};
